/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gld.gui;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.TextField;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/**
 *
 * @author AngelwingedDevil
 */
class LDWindow extends JFrame
{

    LDWindow()
    {
        super();

        try
        {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            SwingUtilities.updateComponentTreeUI(this);
        }
        catch (Exception e)
        {
            Logger.getLogger(LDWindow.class.getName()).log(Level.SEVERE, null, e);
        }
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("SquareSelection");
        setVisible(true);
        setLayout(new GridBagLayout());
        ToolPanel tp = new ToolPanel();
        ToolScrollOption to = new ToolScrollOption(tp);
        ToolRootPanel t = new ToolRootPanel(to);
        add(t);
    }

    class ToolRootPanel extends JPanel
    {

        public ToolRootPanel(ToolScrollOption j)
        {
            super();
            setLayout(new GridLayout(0, 1));
            add(j);
        }
    }

    class ToolScrollOption extends JScrollPane
    {

        private ToolPanel content;

        public ToolScrollOption(ToolPanel c)
        {
            super(c);
            content = c;

            setViewportView(content);
        }
    }

    class ToolPanel extends JPanel
    {
        private JLabel labelSize;
        private JLabel labelName;
        private JTextField txtName;
        private JLabel labelLocation;
        private JLabel labelMouseLocation;
        private JLabel labelPlayer;
        private JLabel txtPlayer;
        private JLabel labelStatus;
        private JLabel labelPlayable;
        
        
        
        public ToolPanel()
        {
            super();
            setupComponents();
        }

        private void setupComponents()
        {
            setLayout(new GridBagLayout());
            GridBagConstraints g = new GridBagConstraints();
            
            labelSize= new JLabel("Size: 5000x5000");
            g.gridx=0;
            g.gridy=0;
            g.weightx=1;
            g.weighty=1;
            g.anchor = GridBagConstraints.CENTER;
            g.insets=new Insets(0, 0, 0, 0);
            g.gridwidth=2;
            g.fill=g.NONE;
            g.ipadx=0;
            g.ipady=0;
            this.add(labelSize, g);
            
            labelName=new JLabel("Name: ");
            g.anchor = GridBagConstraints.LINE_END;
            g.gridy=1;
            g.gridwidth=1;
            this.add(labelName,g);
            
            txtName = new JTextField("of your map");
            g.anchor = GridBagConstraints.LINE_START;
            g.gridx=1;
            g.gridwidth=1;
            this.add(txtName);
            
            labelLocation = new JLabel("Location: ");
            g.anchor = GridBagConstraints.LINE_END;
            g.gridy=2;
            g.gridx=0;
            g.gridwidth=1;
            this.add(labelLocation);
            
            labelMouseLocation = new JLabel("0000x0000");
            g.anchor = GridBagConstraints.LINE_START;
            g.gridx=1;
            g.gridwidth=1;
            this.add(labelMouseLocation);
            
            labelStatus=new JLabel("Status: ");
            g.anchor = GridBagConstraints.LINE_END;
            g.gridy=3;
            g.gridx=0;
            g.gridwidth=1;
            this.add(labelStatus);
            
            labelPlayable = new JLabel("unknown");
            g.anchor = GridBagConstraints.LINE_START;
            g.gridx=1;
            g.gridwidth=1;
            add(labelPlayable,g);
            
            g.gridx=0;
            g.gridy=4;
            g.gridwidth=2;
            g.fill=g.HORIZONTAL;
            add(new JSeparator(JSeparator.HORIZONTAL),g);
        }
    }
}
